#!/bin/sh
#
# Get the supplementary group ID(s) needed to access sound device.
#

set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.

SND_DEV="/dev/snd"

if [ -d "$SND_DEV" ]; then
    # Get the associated group.
    grp="$(find "$SND_DEV" -maxdepth 1 -not -type d -exec stat -c "%g" {} \; | sort -u | tail -n1)"
    echo "$grp"
fi

# vim:ft=sh:ts=4:sw=4:et:sts=4
